0 CpxTRS
↳1 TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID), 0 ms)
↳2 CpxWeightedTrs
↳3 TypeInferenceProof (BOTH BOUNDS(ID, ID), 0 ms)
↳4 CpxTypedWeightedTrs
↳5 CompletionProof (UPPER BOUND(ID), 0 ms)
↳6 CpxTypedWeightedCompleteTrs
↳7 CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID), 0 ms)
↳8 CpxRNTS
↳9 CompleteCoflocoProof (⇔, 240 ms)
↳10 BOUNDS(1, n^1)
or(true, y) → true
or(x, true) → true
or(false, false) → false
mem(x, nil) → false
mem(x, set(y)) → =(x, y)
mem(x, union(y, z)) → or(mem(x, y), mem(x, z))
or(true, y) → true [1]
or(x, true) → true [1]
or(false, false) → false [1]
mem(x, nil) → false [1]
mem(x, set(y)) → =(x, y) [1]
mem(x, union(y, z)) → or(mem(x, y), mem(x, z)) [1]
or(true, y) → true [1]
or(x, true) → true [1]
or(false, false) → false [1]
mem(x, nil) → false [1]
mem(x, set(y)) → =(x, y) [1]
mem(x, union(y, z)) → or(mem(x, y), mem(x, z)) [1]
or :: true:false:= → true:false:= → true:false:= true :: true:false:= false :: true:false:= mem :: a → nil:set:union → true:false:= nil :: nil:set:union set :: b → nil:set:union = :: a → b → true:false:= union :: nil:set:union → nil:set:union → nil:set:union |
or(v0, v1) → null_or [0]
null_or, const, const1
Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules:
The TRS has the following type information:
Rewrite Strategy: INNERMOST |
true => 1
false => 0
nil => 0
null_or => 0
const => 0
const1 => 0
mem(z', z'') -{ 1 }→ or(mem(x, y), mem(x, z)) :|: z >= 0, z' = x, x >= 0, y >= 0, z'' = 1 + y + z
mem(z', z'') -{ 1 }→ 0 :|: z'' = 0, z' = x, x >= 0
mem(z', z'') -{ 1 }→ 1 + x + y :|: z' = x, x >= 0, y >= 0, z'' = 1 + y
or(z', z'') -{ 1 }→ 1 :|: z'' = y, y >= 0, z' = 1
or(z', z'') -{ 1 }→ 1 :|: z' = x, x >= 0, z'' = 1
or(z', z'') -{ 1 }→ 0 :|: z'' = 0, z' = 0
or(z', z'') -{ 0 }→ 0 :|: v0 >= 0, v1 >= 0, z'' = v1, z' = v0
eq(start(V, V1),0,[or(V, V1, Out)],[V >= 0,V1 >= 0]). eq(start(V, V1),0,[mem(V, V1, Out)],[V >= 0,V1 >= 0]). eq(or(V, V1, Out),1,[],[Out = 1,V1 = V2,V2 >= 0,V = 1]). eq(or(V, V1, Out),1,[],[Out = 1,V = V3,V3 >= 0,V1 = 1]). eq(or(V, V1, Out),1,[],[Out = 0,V1 = 0,V = 0]). eq(mem(V, V1, Out),1,[],[Out = 0,V1 = 0,V = V4,V4 >= 0]). eq(mem(V, V1, Out),1,[],[Out = 1 + V5 + V6,V = V5,V5 >= 0,V6 >= 0,V1 = 1 + V6]). eq(mem(V, V1, Out),1,[mem(V7, V8, Ret0),mem(V7, V9, Ret1),or(Ret0, Ret1, Ret)],[Out = Ret,V9 >= 0,V = V7,V7 >= 0,V8 >= 0,V1 = 1 + V8 + V9]). eq(or(V, V1, Out),0,[],[Out = 0,V10 >= 0,V11 >= 0,V1 = V11,V = V10]). input_output_vars(or(V,V1,Out),[V,V1],[Out]). input_output_vars(mem(V,V1,Out),[V,V1],[Out]). |
CoFloCo proof output:
Preprocessing Cost Relations
=====================================
#### Computed strongly connected components
0. non_recursive : [or/3]
1. recursive [non_tail,multiple] : [mem/3]
2. non_recursive : [start/2]
#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into or/3
1. SCC is partially evaluated into mem/3
2. SCC is partially evaluated into start/2
Control-Flow Refinement of Cost Relations
=====================================
### Specialization of cost equations or/3
* CE 5 is refined into CE [11]
* CE 4 is refined into CE [12]
* CE 6 is refined into CE [13]
* CE 7 is refined into CE [14]
### Cost equations --> "Loop" of or/3
* CEs [11] --> Loop 8
* CEs [12] --> Loop 9
* CEs [13,14] --> Loop 10
### Ranking functions of CR or(V,V1,Out)
#### Partial ranking functions of CR or(V,V1,Out)
### Specialization of cost equations mem/3
* CE 10 is refined into CE [15,16,17]
* CE 9 is refined into CE [18]
* CE 8 is refined into CE [19]
### Cost equations --> "Loop" of mem/3
* CEs [18] --> Loop 11
* CEs [19] --> Loop 12
* CEs [16] --> Loop 13
* CEs [15] --> Loop 14
* CEs [17] --> Loop 15
### Ranking functions of CR mem(V,V1,Out)
* RF of phase [13,14,15]: [V1]
#### Partial ranking functions of CR mem(V,V1,Out)
* Partial RF of phase [13,14,15]:
- RF of loop [13:1,13:2,14:1,14:2,15:1,15:2]:
V1
### Specialization of cost equations start/2
* CE 2 is refined into CE [20,21,22]
* CE 3 is refined into CE [23,24,25]
### Cost equations --> "Loop" of start/2
* CEs [21] --> Loop 16
* CEs [23] --> Loop 17
* CEs [20,22,24,25] --> Loop 18
### Ranking functions of CR start(V,V1)
#### Partial ranking functions of CR start(V,V1)
Computing Bounds
=====================================
#### Cost of chains of or(V,V1,Out):
* Chain [10]: 1
with precondition: [Out=0,V>=0,V1>=0]
* Chain [9]: 1
with precondition: [V=1,Out=1,V1>=0]
* Chain [8]: 1
with precondition: [V1=1,Out=1,V>=0]
#### Cost of chains of mem(V,V1,Out):
* Chain [12]: 1
with precondition: [V1=0,Out=0,V>=0]
* Chain [11]: 1
with precondition: [V+V1=Out,V>=0,V1>=1]
* Chain [multiple([13,14,15],[[12],[11]])]: 6*it(13)+1*it([11])+1*it([12])+0
Such that:it([12]) =< V1+1
it([11]) =< V1/2+1/2
aux(1) =< V1
it(13) =< aux(1)
it([11]) =< aux(1)
with precondition: [1>=Out,V>=0,V1>=1,Out>=0,V+V1>=Out+1]
#### Cost of chains of start(V,V1):
* Chain [18]: 1*s(1)+1*s(2)+6*s(4)+1
Such that:s(3) =< V1
s(1) =< V1+1
s(2) =< V1/2+1/2
s(4) =< s(3)
s(2) =< s(3)
with precondition: [V>=0,V1>=0]
* Chain [17]: 1
with precondition: [V1=0,V>=0]
* Chain [16]: 1
with precondition: [V1=1,V>=0]
Closed-form bounds of start(V,V1):
-------------------------------------
* Chain [18] with precondition: [V>=0,V1>=0]
- Upper bound: 15/2*V1+5/2
- Complexity: n
* Chain [17] with precondition: [V1=0,V>=0]
- Upper bound: 1
- Complexity: constant
* Chain [16] with precondition: [V1=1,V>=0]
- Upper bound: 1
- Complexity: constant
### Maximum cost of start(V,V1): 15/2*V1+5/2
Asymptotic class: n
* Total analysis performed in 185 ms.